package com.clip.listener;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class SessionListener implements HttpSessionListener{
	@Override
	public void sessionCreated(HttpSessionEvent se) {
		se.getSession().setMaxInactiveInterval(-1);
//		User user=new User();
//		user.setId(1);
//		user.setEmail("test@myxing.cc");
//		user.setName("行方向");
//		user.setPwd(Functions.md5("123123"));
//		se.getSession().setAttribute(SessionAttibuteKey.USER, user);
//		HttpServletRequest request=ServletActionContext.getRequest();
//		if(request!=null){
//			String flexRequest=request.getParameter("isFlexRequest");
//			if(flexRequest==null||!flexRequest.equals("true")){
//				addFakeUploadHistory(se.getSession());
//			}
//		}else{
//			addFakeUploadHistory(se.getSession());
//		}
	}
	/*private void addFakeUploadHistory(HttpSession session){
		WebApplicationContext context=WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
		DefaultDao dao=(DefaultDao) context.getBean("defaultDao");
		List<Point_pic> list=dao.getAllPointPics();
		int i=0;
		List<UploadHistory> uhList=new ArrayList<UploadHistory>();
		for (Point_pic pointPic : list) {
			UploadHistory history=new UploadHistory();
			history.setId(--i);
			history.setUid(-1);
			history.setFileTitle(pointPic.getDescription());
			FakePointInfo fakePointInfo=new FakePointInfo();
			fakePointInfo.setPointname(pointPic.getPoint_info().getPoint_name());
			fakePointInfo.setPointpicid(pointPic.getId());
			history.setFakePointInfo(fakePointInfo);
			history.setUrl(pointPic.getPic_address());
			uhList.add(history);
		}
		session.setAttribute("fakeuploads", uhList);
	}*/

	@Override
	public void sessionDestroyed(HttpSessionEvent se) {

	}

}
